var TimerOutputModifier = OutputModifier.extend({
	extdiv_id: '5c2dfee9-7fec-4c14-b7c8-789215860970',
	interval: 2000,
	last_time: 0,
	count: 0,
	extdiv: null,
	constructor: function(ime)
	{
		this.base(ime);
		// create an extension DIV
		this.extdiv = ime.mainwin.CreateExtensionDIV(this.extdiv_id,null,null,null,'');
		this.last_time = lib.time();
		this.SetOutputText()
	},
	SetOutputText: function()
	{
		if(this.extdiv) {
			var str;
			var t = parseFloat(lib.time() - this.last_time);

			if(t > 0) {
				var f = parseFloat(this.count)*1000/t;
				str = lib.sprintf("\u6253\u5b57\u901f\u5ea6: %.2f words/sec",f);
			}
			else str = "\u6253\u5b57\u901f\u5ea6: N/A";
			this.extdiv.innerHTML = str;
		}
	},
	ModifierName: function()
	{
		return "\u6253\u5b57\u8a08\u6642\u5668";
	},
	IsVisible: function()
	{
		return true;
	},
	Modify: function(str)
	{
		this.count++;
		var now = lib.time();

		if((now - this.last_time) > this.interval) {
			this.SetOutputText();
			this.count = 0;
			this.last_time = now;
		}
		return str;
	},
	Remove: function()
	{
		ime.mainwnd.DestroyExtensionDIV(this.extdiv_id);
	}
});
